home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
system
/
sysprof3.zip
/
PROFCTRL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-20
|
49KB
|
1,120 lines
/*****************************************************************************/
/* */
/* Listing 2 */
/* */
/* NAME : PROFCTRL */
/* */
/* DATE : March 30, 1988 */
/* */
/* AUTHOR : (C) Copyright 1988 G. Kent Cobb - All Rights Reserved */
/* */
/* DESCRIPTION : */
/* This program provides control functions for the terminate-and-stay- */
/* resident system profiler. The syntax for executing PROFCTRL is: */
/* */
/* */
/* | STATUS | */
/* | ON | */
/* PROFCTRL | OFF | */
/* | ZERO | */
/* | REPORT [output-file-name] | */
/* */
/* The ON and OFF options affect the accumulation of interrupt data; */
/* STATUS reports the current state; ZERO erases all data that has */
/* been accumulated; and REPORT generates a listing that describes */
/* the contents of the tables. */
/* */
/* SYS_PROF and PROFCTRL are most easily used in a batch file, such as: */
/* */
/* */
/* SYS_PROF */
/* PROFCTRL zero */
/* PROFCTRL on */
/* chkdsk c: */
/* PROFCTRL off */
/* PROFCTRL report temp */
/* d:list temp */
/* */
/*****************************************************************************/
/* modifications for Turbo C and updated function descriptions */
/* by Ralf Brown, 5/18/89 */
/*****************************************************************************/
/* additional function call tracking added by Ralf Brown, 6/18/89 */
/*****************************************************************************/
#include "stdio.h"
#include "dos.h"
#ifdef __TURBOC__
# include <stdlib.h>
# include <string.h>
#endif __TURBOC__
#define NUM_INTS 13
#define END_OF_STRING '\0'
#define CONTROL_INTERRUPT 96
#define STATUS 0
#define OFF 1
#define ON 2
#define FIND 3
#define ZERO 4
#define REPORT 5
#define DOS 0x21
#define GET_INT_VECTOR 0x35
#ifdef __TURBOC__ /* prototype the functions */
int error_exit(void) ;
int tally_total_ticks(void) ;
int print_interrupt_summary( int, char *descriptions[] ) ;
int print_line(char *title, long number, long duration) ;
#endif __TURBOC__
struct tally
{
long time;
long number;
};
long total_ticks; /* TOTAL NUMBER OF TIMER TICKS RECORDED. */
char *int_desc[NUM_INTS+1] = {"OTHER",
"PRINT SCREEN - INTERRUPT 5H",
"VIDEO BIOS - INTERRUPT 10H",
"DISK SERVICES - INTERRUPT 13H",
"COMM PORT - INTERRUPT 14H",
"SYSTEM UTILITY SERVICES - INTERRUPT 15H",
"KEYBOARD BIOS - INTERRUPT 16H",
"PRINTER BIOS - INTERRUPT 17H",
"DOS FUNCTIONS - INTERRUPT 21H",
"DOS ABSOLUTE DISK READ - INTERRUPT 25H",
"DOS ABSOLUTE DISK WRITE - INTERRUPT 26H",
"NETWORK - INTERRUPT 2AH",
"MULTIPLEX - INTERRUPT 2FH",
"EXPANDED MEMORY DRIVER - INTERRUPT 67H" };
int max_services[NUM_INTS+1] = {0,0,29,29,6,223,19,3,109,0,0,7,206,108};
char *other_services[] = {""};
char *print_screen_services[] = {""};
char *video_services[] = {"00 - Set Mode",
"01 - Set Cursor Size",
"02 - Set Cursor Position",
"03 - Get Cursor Position",
"04 - Get Light Pen Position",
"05 - Set Active Page",
"06 - Scroll Up",
"07 - Scroll Down",
"08 - Read Character and Attribute",
"09 - Write Character and Attribute",
"0A - Write Character",
"0B - Set Palette",
"0C - Write Dot",
"0D - Read Dot",
"0E - Write TTY",
"0F - Get Mode",
"10 - Service 16",
"11 - Service 17",
"12 - Alternate function select",
"13 - Write String",
"14 - LCD fonts",
"15 - Get physical display parameters",
"16 - Service 22",
"17 - Service 23",
"18 - Service 24",
"19 - Service 25",
"1A - Display combination",
"1B - Functionality/State information",
"1C - Save/Restore video state",
"Undefined services"};
char *disk_services[] = {"00 - Reset Diskette System",
"01 - Get Diskette Status",
"02 - Read Sectors",
"03 - Write Sectors",
"04 - Verify Sectors",
"05 - Format Track",
"06 - Fixed Disk - Format track",
"07 - Fixed Disk - Format drive",
"08 - Get Drive Parameters",
"09 - Initialize Parameter Tables",
"0A - Read Long",
"0B - Write Long",
"0C - Seek to Cylinder",
"0D - Alternate Disk Reset",
"0E - Read sector buffer",
"0F - Write sector buffer",
"10 - Test Ready",
"11 - Recalibrate Drive",
"12 - Controller RAM Diagnostics",
"13 - Drive Diagnostics",
"14 - Controller Diagnostics",
"15 - Get Disk Type",
"16 - Change Disk Status",
"17 - Set Disk Type",
"18 - Set Media Type for Form